<template>
  <a-form ref="formRef" :model="form" :rules="rules" layout="vertical">
    <a-row :gutter="20">
      <a-col :span="12">
        <a-form-item name="orderId">
          <template #label>
            <span>
              订单ID
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-input v-model:value="form.orderId" :disabled="isUpdate" allow-clear placeholder="请输入订单ID"/>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="orgDataCode">
          <template #label>
            <span>
              数据机构
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-tree-select
            v-model:value="form.orgDataCode"
            placeholder="请选择"
            :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
            :treeData="props.orgidlist"
            :replaceFields="{label: 'ORG_NAME', key: 'ORG_ID',value: 'ORG_ID',children:'children' }"
            show-search
          >


          </a-tree-select>
          <!--          <dict-select v-model:value="form.orgDataCode" valueType="dictId" dictTypeId="1348235720908619811"
                                 placeholder="请选择"/>-->
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="itemCode">
          <template #label>
            <span>
              件号
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-select
            v-model:value="form.itemCode"
            placeholder="请选择"
          >
            <a-select-option
              v-for="item in props.itemlist"
              :key="item.ITEMCODE"
              :value="item.ITEMCODE">
              {{ item.ITEMCODE + '-' + item.ITEMNAME }}
            </a-select-option>
          </a-select>
          <!--          <dict-select v-model:value="form.itemCode" valueType="dictId" dictTypeId="1348235720908619811"
                                 placeholder="请选择"/>-->
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="batchCode">
          <template #label>
            <span>
              批次号
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-input v-model:value="form.batchCode" allow-clear placeholder="请输入批次号"/>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="routeCode">
          <template #label>
            <span>
              工艺路径
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-select
            v-model:value="form.routeCode"
            placeholder="请选择"
          >
            <a-select-option
              v-for="item in props.routelist"
              :key="item.ROUTE_CODE"
              :value="item.ROUTE_CODE">
              {{ item.ROUTE_CODE + '-' + item.ROUTE_NAME }}
            </a-select-option>
          </a-select>
          <!--          <dict-select v-model:value="form.routeCode" valueType="dictId" dictTypeId="1348235720908619811"
                                 placeholder="请选择"/>-->
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="PRIORITY">
          <template #label>
            <span>
              优先级
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-input-number v-model:value="form.priority" style="width: 100%" placeholder="请输入优先级" allow-clear
                          autocomplete="off"/>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="planCount">
          <template #label>
            <span>
              计划数量
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-input-number v-model:value="form.planCount" style="width: 100%" placeholder="请输入计划数量" allow-clear
                          autocomplete="off"/>
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="planStartTime">
          <template #label>
            <span>
              计划开始时间
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-date-picker
            v-model:value="form.planStartTime"
            show-time
            value-format="YYYY-MM-DD HH:mm:ss"
            placeholder="请选择计划开始时间"
            style="width: 100%"
          />
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="planEndTime">
          <template #label>
            <span>
              计划结束时间
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <a-date-picker
            v-model:value="form.planEndTime"
            show-time
            value-format="YYYY-MM-DD HH:mm:ss"
            placeholder="请选择计划结束时间"
            style="width: 100%"
          />
        </a-form-item>
      </a-col>
      <a-col :span="12">
        <a-form-item name="itemStatus">
          <template #label>
            <span>
              加工零件状态
              <a-tooltip v-if="false">
                <template #title></template>
                <QuestionCircleOutlined/>
              </a-tooltip>
              <span>：</span>
            </span>
          </template>
          <dict-select v-model:value="form.itemStatus" valueType="dictCode" dictTypeId="1735960326503501826"
                       placeholder="请选择"/>
        </a-form-item>
      </a-col>
    </a-row>


  </a-form>
</template>

<script setup name="ProductionOrderForm">
import {reactive, ref} from 'vue';
import DictSelect from '@/components/DictSelect/DictSelect.vue';
import {Common} from "@/api/Common";


const props = defineProps({
  // 表单数据
  form: Object,
  isUpdate:false,
  orgidlist:Array,
  itemlist:Array,
  routelist:Array,
});
// 验证规则
const rules = reactive({
  orderId: [{required: true, message: '请输入订单ID', type: 'string', trigger: 'blur'}],
  orgDataCode: [{required: true, message: '请输入数据机构', type: 'string', trigger: 'blur'}],
  itemCode: [{required: true, message: '请输入件号', type: 'string', trigger: 'blur'}],
  batchCode: [{required: true, message: '请输入批次号', type: 'string', trigger: 'blur'}],
  routeCode: [{required: true, message: '请输入工艺路径', type: 'string', trigger: 'blur'}],
  priority: [{required: true, message: '请输入优先级', type: 'number', trigger: 'blur'}],
});


defineExpose()
</script>

<style></style>
